// ****************************************************************
//
// Logic 8: Shop
//
// ****************************************************************

#include "defines.txt"
#define guy o10
if (new_room)
{
  load.pic(room_no);
  draw.pic(room_no);
  discard.pic(room_no);
  set.horizon(17);

animate.obj(o10);
load.view(18);
set.view(o10,18);
set.loop(o10,0);
set.cel(o10,0);
position(o10,68,109);
set.priority(o10,4);
stop.cycling(o10);
ignore.objs(o10);
draw(o10);

  //ADD ADDITIONAL INITIALIZATION CODE HERE

  if (prev_room_no == 7)
  {
    position(o0, 66, 160);
  }
  draw(o0);
  show.pic();
}

if (ego_edge_code == bottom_edge)
{
  //ADD ADDITIONAL BOTTOM EXIT CODE HERE
  new.room(7);
}
if (f2 && unknown_word_no == 0 && !input_parsed)
{  if (said("look"))
  {
    print("It is a shop with various odds and ends.");
  }
}

 if(said("speak")) {
     print("Hello, how are you?");
     print("Welcome to my store of various odds and ends.");
     if (has("pearl")) {
     print("Hey you have the most beautiful pearl!");
     print("I must have it!");
     print("Will you give it to me?");
    }
   }

      if (said("give", "pearl")) {
      if (posn(o0,55,75,99,136)) {
         if (!has("green coins")) {
         if (has("pearl")) {
       print("You're going to give me that wonderful pearl! Thank You!");
       print("In exchange, I will give to you these coins that will be of great wealth to you on your quest!");
       get("green coins");
       drop(i6);
       v3 += 3;
      }
      else {
       print("Get closer.");
      }
     }
      else {
       print("What pearl?");
     }
    }
   }
return();